#ifndef __MPI_TRACER_FORTRAN_H
#define __MPI_TRACER_FORTRAN_H

typedef int MPI_Fint;
MPI_Comm PMPI_Comm_f2c(MPI_Fint comm);
MPI_Datatype PMPI_Type_f2c(MPI_Fint datatype);
MPI_Request PMPI_Request_f2c(MPI_Fint request);
int PMPI_Status_f2c(const MPI_Fint *f_status, MPI_Status *c_status);

typedef void(*MPI_INIT_FORTRAN)(MPI_Fint *ierr );

typedef void(*MPI_INIT_THREAD_FORTRAN)(MPI_Fint *required, MPI_Fint *provided, MPI_Fint *ierr);
typedef void(*MPI_FINALIZE_FORTRAN)(MPI_Fint *ierr);

typedef void(*MPI_SEND_FORTRAN)(char *buf, MPI_Fint *count, MPI_Fint *datatype,
                MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr);
typedef void(*MPI_ISEND_FORTRAN)(char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest,
    MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr);

typedef void(*MPI_SSEND_FORTRAN)(char *buf, MPI_Fint *count, MPI_Fint *datatype,
    MPI_Fint *dest, MPI_Fint *tag,
    MPI_Fint *comm, MPI_Fint *ierr);

typedef void(*MPI_ISSEND_FORTRAN)(char *buf, MPI_Fint *count, MPI_Fint *datatype,
    MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, 
    MPI_Fint *request, MPI_Fint *ierr);
typedef void (*MPI_BSEND_FORTRAN)(char *buf, MPI_Fint *count, MPI_Fint *datatype, 
    MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr);

typedef void(*MPI_IBSEND_FORTRAN)(char *buf, MPI_Fint *count, MPI_Fint *datatype,
		  MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm,
		  MPI_Fint *request, MPI_Fint *ierr);

typedef void (*MPI_RSEND_FORTRAN)(char *ibuf, MPI_Fint *count, MPI_Fint *datatype,
		 MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr);

typedef void(*MPI_IRSEND_FORTRAN)(char *buf, MPI_Fint *count, MPI_Fint *datatype, 
      MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr);

typedef void(*MPI_RECV_FORTRAN)(char *buf, MPI_Fint *count, MPI_Fint *datatype,
                MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm,
               MPI_Fint *status, MPI_Fint *ierr); 

typedef void(*MPI_IRECV_FORTRAN)(char *buf, MPI_Fint *count, MPI_Fint *datatype,
		 MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm,
		 MPI_Fint *request, MPI_Fint *ierr);
typedef void(*MPI_WAIT_FORTRAN)(MPI_Fint *request, MPI_Fint *status, MPI_Fint *ierr);
typedef void(*MPI_WAITALL_FORTRAN)(MPI_Fint *count, MPI_Fint *array_of_requests,
		   MPI_Fint *array_of_statuses, MPI_Fint *ierr);
typedef void(*MPI_TEST_FORTRAN)(MPI_Fint *request, MPI_Fint *flag,
                MPI_Fint *status, MPI_Fint *ierr);

/*typedef void(*MPI_TEST_FORTRAN)(MPI_Fint *request, ompi_fortran_logical_t *flag,
               MPI_Fint *status, MPI_Fint *ierr);*/
typedef void(*MPI_TESTALL_FORTRAN)(MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *flag, 
            MPI_Fint *array_of_statuses, MPI_Fint *ierr);
typedef void(*MPI_ALLTOALL_FORTRAN)(char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype,
		    char *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype,
		    MPI_Fint *comm, MPI_Fint *ierr);
typedef void(*MPI_BCAST_FORTRAN)(char *buffer, MPI_Fint *count, MPI_Fint *datatype,
		 MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr);
typedef void(*MPI_IBCAST_FORTRAN)(char *buffer, MPI_Fint *count, MPI_Fint *datatype,
                   MPI_Fint *root, MPI_Fint *comm, MPI_Fint *request,
                   MPI_Fint *ierr);

typedef void(*MPI_REDUCE_FORTRAN)(char *sendbuf, char *recvbuf, MPI_Fint *count,
		  MPI_Fint *datatype, MPI_Fint *op,
		  MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr);
typedef void(*MPI_IREDUCE_FORTRAN)(char *sendbuf, char *recvbuf, MPI_Fint *count,
                    MPI_Fint *datatype, MPI_Fint *op,
                    MPI_Fint *root, MPI_Fint *comm, MPI_Fint *request,
                    MPI_Fint *ierr);
typedef void(*MPI_ALLREDUCE_FORTRAN)(char *sendbuf, char *recvbuf, MPI_Fint *count,
		     MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm,
		     MPI_Fint *ierr);
typedef void(*MPI_IALLREDUCE_FORTRAN)(char *sendbuf, char *recvbuf, MPI_Fint *count,
                       MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm,
                       MPI_Fint *request, MPI_Fint *ierr);
typedef void(*MPI_IALLTOALL_FORTRAN)(char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype,
                      char *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype,
                      MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr);
typedef void(*MPI_BARRIER_FORTRAN)(MPI_Fint *comm, MPI_Fint *ierr);
typedef void(*MPI_IBARRIER_FORTRAN)(MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr);

typedef void(*MPI_COMM_SPLIT_FORTRAN)(MPI_Fint *comm, MPI_Fint *color, MPI_Fint *key,
		      MPI_Fint *newcomm, MPI_Fint *ierr);

typedef void(*MPI_COMM_DUP_FORTRAN)(MPI_Fint *comm, MPI_Fint *newcomm, MPI_Fint *ierr);
typedef void(*MPI_COMM_CREATE_FORTRAN)(MPI_Fint *comm, MPI_Fint *group, MPI_Fint *newcomm, MPI_Fint *ierr);

typedef void(*MPI_GATHER_FORTRAN)(char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype,
		  char *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype,
		  MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr);
typedef void(*MPI_IGATHER_FORTRAN)(char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype,
                    char *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype,
                    MPI_Fint *root, MPI_Fint *comm, MPI_Fint *request,
                    MPI_Fint *ierr);
typedef void(*MPI_ALLGATHER_FORTRAN)(char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype,
		     char *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype,
		     MPI_Fint *comm, MPI_Fint *ierr);
typedef void(*MPI_IALLGATHER_FORTRAN)(char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype,
                       char *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype,
                       MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr);
typedef void(*MPI_SCATTER_FORTRAN)(char *sendbuf, MPI_Fint *sendcount,
		   MPI_Fint *sendtype, char *recvbuf,
		   MPI_Fint *recvcount, MPI_Fint *recvtype,
		   MPI_Fint *root, MPI_Fint *comm, MPI_Fint *ierr);

typedef void(*MPI_ISCATTER_FORTRAN)(char *sendbuf, MPI_Fint *sendcount,
                     MPI_Fint *sendtype, char *recvbuf,
                     MPI_Fint *recvcount, MPI_Fint *recvtype,
                     MPI_Fint *root, MPI_Fint *comm, MPI_Fint *request,
                     MPI_Fint *ierr);
#endif // __MPI_TRACER_FORTRAN_H